<.focus_box>
  <:title>
    Reset your password
  </:title>

  <:subtitle>
    Enter your email so we can send a password reset link
  </:subtitle>

  <.form :let={f} for={@conn} action={Routes.auth_path(@conn, :password_reset_request)}>
    <div class="my-4 mt-8">
      <.input type="email" field={f[:email]} placeholder="user@example.com" />
    </div>
    <%= if @conn.assigns[:error] do %>
      <div class="text-red-500 my-2">{@conn.assigns[:error]}</div>
    <% end %>

    <%= if PlausibleWeb.Captcha.enabled?() do %>
      <div class="mt-4">
        <div class="h-captcha" data-sitekey={PlausibleWeb.Captcha.sitekey()}></div>
        <%= if assigns[:captcha_error] do %>
          <div class="text-red-500 text-xs mt-3">{@captcha_error}</div>
        <% end %>
        <script src="https://hcaptcha.com/1/api.js" async defer>
        </script>
      </div>
    <% end %>

    <.button class="w-full" type="submit">Send reset link</.button>
  </.form>
</.focus_box>
